package com.vogue.supplymall.payment.config;

import com.vogue.supplymall.account.shiro.filter.MallAuthenticationFilter;
import com.vogue.supplymall.common.config.JacksonConvert;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.http.converter.HttpMessageConverter;
import java.util.List;

@Configuration
@ComponentScan(value = { 
        "com.vogue.supplymall.common.domain.tool"
         ,"com.vogue.supplymall.common.domain.dto"
         ,"com.vogue.supplymall.payment.dto"
         ,"com.vogue.supplymall.common.config"
})
@ComponentScan("com.vogue.supplymall.payment.api")
@ImportResource(locations = { "classpath:payment-context.xml", "classpath:base-context.xml" })
public class PaymentConfig extends com.vogue.supplymall.common.config.BaseAppConfig {

    @Bean
    public FilterRegistrationBean regAuth(MallAuthenticationFilter filter) {
        FilterRegistrationBean registration = new FilterRegistrationBean(filter);
        registration.setEnabled(false);
        return registration;
    }

    @Override
    public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
        JacksonConvert.convert(converters);
    }
}
